<template>
	<view class="wrap">
		<view class="main" v-if="hasLoad">
			<view class="box">
        <view class="eat-method">
          <view class="b-way" v-for="(item, index) in deployList" :key="index"
                :class="{'f-active': item.alias === eatMethod}" @click="onChooseDeploy(index)">{{item.name}}
          </view>
        </view>
				<view class="main-info">
					<view class="shop-info"  v-if="eatMethod === 'meat'">
						<view class="b-name">
							<view class="s-tit">{{shopData.name}}</view>
<!--							<view class="s-switch" @click="onChooseShop">切换门店</view>-->
						</view>
						<view class="b-address" style="display: flex;" @click="gotoMap(shopData)">
              <view class="s-icon iconfont icon-address"></view>
              <view>{{shopData.address}}</view>
            </view>

            <view style="color: #808080;font-size: 24rpx;display: flex;margin-top: 10px"  @click="callPhone(shopData.contact)">
              <view class="s-icon iconfont icon-contract"></view>
              <view>联系电话:{{shopData.contact}}</view>
            </view>
					</view>

          <view class="shop-info"  v-if="eatMethod === 'pack'">
            <view class="b-name">
              <view class="s-tit">机场发货点</view>
            </view>
            <view class="b-address" style="display: flex;" @click="gotoMap({ latitude:'30.551023',longitude:'104.006899',name:'成都市双流区西航港新街783号'})">
              <view class="s-icon iconfont icon-address"></view>
              <view>成都市双流区西航港新街783号</view>
            </view>
            <view style="color: #808080;font-size: 24rpx;display: flex;margin-top: 10px" @click="callPhone('028-87057905')">
              <view class="s-icon iconfont icon-contract"></view>
              联系电话:028-87057905
            </view>

          </view>
				</view>

			</view>

			<view class="box">
				<view class="gift-list">
					<view class="gift-item" v-for="(item, index) in orderData.goods_list" :key="index">
						<view class="item-main">
							<view class="b-left">
								<image :src="item.goods_cover" mode="aspectFill"></image>
							</view>
							<view class="b-right">
								<view class="b-title">{{item.goods_name}}</view>
								<view class="b-spec">
									<view class="s-value">{{item.goods_names}}</view>
								</view>
								<view class="b-fund">
									<view class="b-amount">
										<view class="s-num">¥{{item.payment}}</view>
										<view class="s-worth" v-if="item.payment != item.goods_price">¥{{item.goods_price}}</view>
									</view>
									<view class="s-count">x{{item.goods_count}}</view>
								</view>
							</view>
						</view>
						<!-- 宠物信息表单 -->
						<view class="pet-info">
							<view class="info-title">宠物信息</view>
							<view class="pet-form">
								<view class="form-left">
									<view class="upload" @click="() => onUploadPetPhoto(index)">
										<image v-if="item.petPhoto" :src="item.petPhoto" mode="aspectFill" class="preview"></image>
										<view v-else class="upload-btn">
											<text class="iconfont icon-camera"></text>
											<text>上传照片</text>
										</view>
									</view>
								</view>
								<view class="form-right">
									<view class="form-row">
										<text class="label">品种</text>
										<input class="input" type="text" v-model="item.petBreed" placeholder="请输入宠物品种" />
									</view>
									<view class="form-row">
										<text class="label">性别</text>
										<view class="radio-group">
											<label class="radio">
												<radio value="male" name="Gender" :checked="item.petGender === 'male'" @click="() => onPetGenderChange({detail:{value:'male'}}, index)" />
												<text>公</text>
											</label>
											<label class="radio">
												<radio value="female" name="Gender" :checked="item.petGender === 'female'" @click="() => onPetGenderChange({detail:{value:'female'}}, index)" />
												<text>母</text>
											</label>
										</view>
									</view>
									<view class="form-row">
										<text class="label">宠物年龄</text>
										<view class="age-inputs">
											<input 
												type="number" 
												v-model="item.pet_age_year"
												class="age-input"
											/>
											<text class="age-unit">岁</text>
											<input 
												type="number" 
												v-model="item.pet_age_month"
												class="age-input"
											/>
											<text class="age-unit">月</text>
										</view>
									</view>
									<view class="form-row">
										<text class="label">绝育</text>
										<switch :checked="item.isSterilized" @change="(e) => onSterilizedChange(e, index)" color="#FF9523" />
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
      <view class="box">
        <view class="b-head">托运信息</view>
        <view class="shipping-form">
          <!-- 托运人信息 -->
          <view class="form-section">
            <view class="section-title">托运人信息</view>
            <view class="form-item">
              <text class="label">姓名</text>
              <view class="input-wrapper">
                <input class="input" type="text" v-model="formData.senderName" placeholder="请输入托运人姓名" />
              </view>
            </view>
            <view class="form-item">
              <text class="label">电话</text>
              <view class="input-wrapper">
                <input class="input" type="number" v-model="formData.senderPhone" placeholder="请输入托运人电话" />
              </view>
            </view>
          </view>

          <!-- 接收人信息 -->
          <view class="form-section">
            <view class="section-title">接收人信息</view>
            <view class="form-item">
              <text class="label">姓名</text>
              <view class="input-wrapper">
                <input class="input" type="text" v-model="formData.receiverName" placeholder="请输入接收人姓名" />
              </view>
            </view>
            <view class="form-item">
              <text class="label">电话</text>
              <view class="input-wrapper">
                <input class="input" type="number" v-model="formData.receiverPhone" placeholder="请输入接收人电话" />
              </view>
            </view>
            <view class="form-item">
              <text class="label">地址</text>
              <view class="input-wrapper">
                <input class="input" type="text" v-model="formData.receiverAddress" placeholder="请输入接收人地址" />
                <text class="iconfont icon-address" @click="chooseAddress"></text>
              </view>
            </view>
          </view>

          <!-- 其他信息 -->
          <view class="form-section">
            <view class="section-title">其他信息</view>
            <view class="form-item">
              <text class="label">期望出发日期</text>
              <view class="input-wrapper">
                <picker mode="date" :value="formData.departureDate" @change="onDateChange" >
                  <view class="input">{{formData.departureDate || '请选择出发日期'}}</view>
                </picker>
                <text class="label" style="color: #FF9626">根据航班情况调整</text>

              </view>
            </view>
            <view class="form-item">
              <text class="label">备注</text>
              <textarea class="textarea" v-model="formData.remark" placeholder="请输入备注信息" />
            </view>
          </view>
        </view>
      </view>
			<view class="box">
				<view class="b-row f-fund">
					<view class="b-tit">总价:</view>
					<view class="b-cont">
						<view class="s-num">¥{{orderData.total_price}}</view>
					</view>
				</view>
				<view class="b-row f-fund">
					<view class="b-tit">优惠金额:</view>
					<view class="b-cont">
						<view class="s-num">¥{{orderData.total_discount}}</view>
					</view>
				</view>
				<view class="b-row f-fund f-payment">
					<view class="b-tit"></view>
					<view class="b-cont">
						<view class="s-tit">应付：</view>
						<view class="s-num">¥{{orderData.total_payment}}</view>
					</view>
				</view>
			</view>
			<view class="box">
				<view class="b-head">支付方式</view>
				<view class="b-row f-wallet">
					<view class="b-tit">
						<view class="iconfont icon-card1"></view>
						<view class="s-tit">储值卡</view>
						<text class="s-left">
							<text>(余额：{{orderData.fund_amount_left}}</text>
							<text class="s-use" v-if="fundAmount>0">-{{fundAmount}}</text>
							<text>)</text>
						</text>
						<view class="s-recharge" @click="onRecharge">去充值</view>
					</view>
					<view class="b-cont">
						<switch color="#FF9626" :disabled="orderData.fund_amount_left <=0" @change="onSwitchChange"
							data-field="use_fund_amount">
						</switch>
					</view>
				</view>
				<view v-if="totalPayment > 0">
					<radio-group @change="onRadioChange" v-for="(item, index) in payList" :key="index">
						<view class="b-row f-pay">
							<view class="b-tit">
								<view class="iconfont" :class="'icon-'+item.icon"></view>
								<view class="s-tit">{{item.name}}</view>
							</view>
							<view class="b-cont">
								<radio value="wechat" :checked="item.checked" color="#FF9626" />
							</view>
						</view>
					</radio-group>
				</view>
			</view>
			<view class="navbar">
				<view class="b-amount">
					<checkbox-group @change="onAgreementChange">
						<label class="agreement-label">
							<checkbox value="1" color="#FF9626" :checked="formData.hasAgreed" />
							<text>我已阅读并同意</text>
							<text class="agreement-link" @click="gotoAgreement">《用户协议》</text>
						</label>
					</checkbox-group>
				</view>
				<view class="b-action">
					<view class="s-exchange" @click="onSubmitOrder">确认下单</view>
				</view>
			</view>
		</view>
		<!-- 加载中 -->
		<load-more :loadingType="loadingType" :loadingText="loadingText" :top="300"></load-more>
		<!-- 首页 -->
		<app-home></app-home>
	</view>
</template>

<script>
	import {
		handleCart,
		previewOrder,
		submitOrder,
		oncePay
	} from '@/service/api/order.js'
	import {
		requestPayment,
		subscriberMessage
	} from '@/service/request/main.js'
	import Util from '@/common/util.js'
	import mixinsAuth from '@/mixins/auth.js'
	import mixinsCommon from '@/mixins/common.js'
	export default {
		mixins: [mixinsCommon, mixinsAuth],
		data() {
			return {
				disable: {
					submit: false
				},
				shopData: {},
				deskData: null,
				orderData: {},
				formData: {
					shop_id: 0,
					desk_id: 0,
					enjoy_type: '',
					contact: '',
					goods_list: [],
					note: '',
					total_price: 0,
					total_payment: 0,
					// 托运信息
					senderName: '',
					senderPhone: '',
					receiverName: '',
					receiverPhone: '',
					receiverAddress: '',
					departureDate: '',
					remark: '',
					// 用户协议
					hasAgreed: false,
					pet_age_year: '',
					pet_age_month: '',
				},
        deployList: [{
						icon: 'icon-meat',
						alias: 'meat',
						name: '送到该门店',
					},
					{
						icon: 'icon-pack',
						alias: 'pack',
						name: '机场发货点'
					}
				],
				payList: [{
					icon: 'pay-wechat',
					alias: 'wechat',
					name: '微信支付',
					checked: true
				}],
				payIndex: 0,
				hasLoad: false,
				loadingType: 1,
				loadingText: ''
			}
		},
		onLoad(options) {
			let goodsData = options.goods_data
			this.goodsData = JSON.parse(goodsData)
      this.loadPreview()
		},
		onShow() {
			// 移除这里的loadPreview调用
		},
		computed: {
			eatMethod() {
				return this.$store.getters.eatMethod
			},
			eatContact() {
				return this.$store.getters.eatContact
			},
			totalPayment() {
				let totalPayment = this.orderData.total_payment
				if (this.formData.use_fund_amount) {
					if (this.orderData.fund_amount_left - this.orderData.total_payment >= 0) {
						totalPayment = 0
					} else {
						totalPayment = this.orderData.total_payment - this.orderData.fund_amount_left
					}
				}
				return totalPayment
			},
			fundAmount() {
				return (this.orderData.total_payment - this.totalPayment).toFixed(2)
			}
		},
		methods: {
			loadPreview() {
				previewOrder({
					goods_list: this.goodsData,
					shop_id: this.$store.getters.shopId,
					desk_id: this.$store.getters.deskId
				}).then(([err, res]) => {
					console.log('previewOrder', err, res)
					if (!err) {
						this.hasLoad = true
						this.loadingType = -1
						// 保存原始数据
						this.orderData = JSON.parse(JSON.stringify(res))
						this.shopData = res.shop_data
						this.deskData = res.desk_data
						this.formData.shop_id = res.shop_data.id
						this.formData.goods_list = JSON.parse(JSON.stringify(res.goods_list))
						this.formData.total_price = res.total_price
						this.formData.total_payment = res.total_payment
					} else {
						this.loadingType = 3
						this.loadingText = err.data.msg || '加载失败'
					}
				})
			},
			onChooseShop(e) {
				uni.navigateTo({
					url: '/pages/shop/index'
				})
			},
			onChooseDeploy(index) {
				console.log('onChooseDeploy', index)
				this.$store.commit('setEatMethod', this.deployList[index].alias)
			},
			// 输入内容
			onInputText(e) {
				console.log('onInputText', e)
				const field = e.target.dataset.field
				let value = e.detail.value
				this.formData[field] = value
				if (field === 'contact') {
					this.$store.commit('setEatContact', value)
				}
			},
			onSwitchChange(e) {
				console.log('onSwitchChange', e)
				this.formData[e.target.dataset.field] = e.detail.value ? 1 : 0
			},
			onRadioChange(e) {
				console.log('onRadioChange', e)
			},
			onSubmitOrder() {
				// 验证用户协议
				if (!this.formData.hasAgreed) {
					return this.$logic.showToast('请阅读并同意用户协议')
				}

				// 托运人信息验证
				if (!this.formData.senderName) {
					return this.$logic.showToast('请输入托运人姓名')
				}
				if (!this.formData.senderPhone) {
					return this.$logic.showToast('请输入托运人电话')
				}
				if (!/^1[3-9]\d{9}$|^0\d{2,3}-?\d{7,8}$/.test(this.formData.senderPhone)) {
					return this.$logic.showToast('请输入正确的托运人电话')
				}

				// 接收人信息验证
				if (!this.formData.receiverName) {
					return this.$logic.showToast('请输入接收人姓名')
				}
				if (!this.formData.receiverPhone) {
					return this.$logic.showToast('请输入接收人电话')
				}
				if (!/^1[3-9]\d{9}$|^0\d{2,3}-?\d{7,8}$/.test(this.formData.receiverPhone)) {
					return this.$logic.showToast('请输入正确的接收人电话')
				}
				if (!this.formData.receiverAddress) {
					return this.$logic.showToast('请输入接收人地址')
				}

				// 宠物信息验证
				for (let i = 0; i < this.orderData.goods_list.length; i++) {
					const item = this.orderData.goods_list[i]
					if (!item.petBreed) {
						return this.$logic.showToast(`请输入宠物品种`)
					}
					if (!item.petGender) {
						return this.$logic.showToast(`请选择宠物性别`)
					}
					if (!item.pet_age_year || !item.pet_age_month) {
						return this.$logic.showToast(`请输入宠物年龄`)
					}
					if (!/^\d+$/.test(item.pet_age_year) || !/^\d+$/.test(item.pet_age_month)) {
						return this.$logic.showToast(`请输入正确宠物年龄`)
					}
					if (!item.petPhoto) {
						return this.$logic.showToast(`请上传宠物照片`)
					}
				}

				// 其他信息验证
				if (!this.formData.departureDate) {
					return this.$logic.showToast('请选择出发日期')
				}
				// 验证出发日期不能早于今天
				const today = new Date()
				const departureDate = new Date(this.formData.departureDate)
				if (departureDate < today) {
					return this.$logic.showToast('出发日期不能早于今天')
				}
				

				this.formData.enjoy_type = this.eatMethod
				// #ifdef  MP-WEIXIN
				if (this.orderData.subscribe_template_ids.length > 0) {
					subscriberMessage(this.orderData.subscribe_template_ids).then(([err, res]) => {
						console.log('subscriberMessage', err, res)
						this.execSubmitOrder()
					})
				} else {
					this.execSubmitOrder()
				}
				// #endif
				// #ifdef  H5
				this.execSubmitOrder()
				// #endif
			},
			execSubmitOrder() {
				this.disable.submit = true
				// 将宠物信息添加到formData.goods_list中
				this.formData.goods_list = this.orderData.goods_list.map(item => ({
					...item,
					petBreed: item.petBreed,
					petGender: item.petGender,
          petAge: item.pet_age_year+"岁"+item.pet_age_month+"月",
					petPhoto: item.petPhoto,
					isSterilized: item.isSterilized
				}))
				
				submitOrder(this.formData).then(([err, res]) => {
					console.log('submitOrder', err, res)
					this.disable.submit = false
					if (!err) {
						for (let i = 0; i < this.goodsData.length; i++) {
							let goodsData = this.goodsData[i]
							if (goodsData.cart_id) {
								handleCart(goodsData.cart_id, 'delete').then(([err, res]) => {
									if (!err) {
										this.$store.commit('delCartItem', goodsData.cart_id)
									}
								})
							}
						}
						if (res.payment_status == 1) {
							const payAlias = this.payList[this.payIndex].alias
							requestPayment(res.order_no, payAlias, 'onceOrder')
						} else {
							uni.reLaunch({
								url: '/pages/order/detail?order_no=' + res.order_no
							})
						}
					}
				})
			},
			onRecharge() {
				uni.navigateTo({
					url: '/pages/user/fund'
				})
			},
      callPhone(phone){
        uni.makePhoneCall({
          phoneNumber: phone,
          success: function() {
          },
          fail: function() {
          }
        });
      },
      gotoMap(obj){
        if(!obj.latitude || !obj.longitude){
          this.$logic.showToast('暂未设置经纬度，无法跳转')
          return;
        }
        uni.openLocation({
          latitude: parseFloat(obj.latitude),
          longitude: parseFloat(obj.longitude),
          name: '',
          address: '',
          success: function () {
          },
          fail:function (e){
            console.log(e)
          }
        });
      },
			onPetGenderChange(e, index) {
				this.orderData.goods_list[index].petGender = e.detail.value
			},
			onSterilizedChange(e, index) {
				this.orderData.goods_list[index].isSterilized = e.detail.value
			},
			onDateChange(e) {
				this.formData.departureDate = e.detail.value
			},
			onUploadPetPhoto(index) {
				uni.chooseImage({
					count: 1,
					success: (res) => {
						// 使用Vue.set来确保响应式更新
						this.$set(this.orderData.goods_list[index], 'petPhoto', res.tempFilePaths[0])
						this.$set(this.formData.goods_list[index], 'petPhoto', res.tempFilePaths[0])
					}
				})
			},
			onAgreementChange(e) {
				this.formData.hasAgreed = e.detail.value.length > 0
			},
			gotoAgreement() {
        uni.navigateTo({
          url: '/pages/content/page_detail?id=2'
        })
			},
			chooseAddress() {
				// #ifdef MP-WEIXIN
				uni.chooseAddress({
					success: (res) => {
						this.formData.receiverName = res.userName
						this.formData.receiverPhone = res.telNumber
						this.formData.receiverAddress = `${res.provinceName}${res.cityName}${res.countyName}${res.detailInfo}`
					}
				})
				// #endif
			}
		}
	}
</script>

<style lang="scss">
	page {
		padding-bottom: env(safe-area-inset-bottom);
		background: $pq-bg-color;
	}

	/* input 样式 */
	.input-placeholder,
	.placeholder {
		color: #999999;
		text-align: right;
	}

	.wrap {
		padding-bottom: 150upx;
	}

	.main {
		padding: 20upx;
	}

  .eat-method {
    height: 60upx;
    line-height: 60upx;
    border-radius: 30upx;
    font-size: 24upx;
    color: #999;
    display: flex;
    align-items: center;

    .b-way {
      width: 200upx;
      height: 60upx;
      background: #FAFAFA;
      text-align: center;
      border-radius: 30upx;
      margin-right: 20upx;

      &.f-active {
        color: #fff;
        background: $pq-active-color;
        border-radius: 30upx;
      }
    }
  }

	.main-info {
		padding-bottom: 30upx;
    margin-top: 10upx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.shop-info {
			.b-name {
				display: flex;
				align-items: center;
				justify-content: space-between;
				color: $pq-main-color;
				font-size: 28upx;

				.s-tit {
					font-weight: bold;
				}

				.s-switch {
					color: $pq-active-color;
					font-size: 24upx;
					padding: 6upx 20upx;
					border: 1upx solid $pq-active-color;
					border-radius: 24upx;
				}
			}

			.b-address {
				margin-top: 20upx;
				color: $pq-minor-color;
				font-size: 24upx;
			}
		}


	}

	.gift-head {
		margin-top: 30upx;
		padding: 20upx 30upx;
		font-size: 28upx;
		color: #333;
		background: #fff;
		border-bottom: 2upx solid #eee;
	}

	.gift-list {
		background: #fff;

		.gift-item {
			margin-bottom: 30upx;
			
			.item-main {
				display: flex;
				align-items: center;
				padding-bottom: 20upx;
				
				.b-left {
					width: 140upx;
					height: 140upx;
					flex-shrink: 0;
	
					image {
						width: 100%;
						height: 100%;
						border-radius: 10upx;
					}
				}
	
				.b-right {
					margin-left: 30upx;
					flex: 1;
	
					.b-title {
						font-size: 28upx;
						color: #333;
					}
	
					.b-spec {
						margin-top: 20upx;
						display: flex;
						align-items: center;
						height: 30upx;
	
						.s-tit {
							margin-right: 10upx;
							font-size: 24upx;
							color: #999;
						}
	
						.s-value {
							font-size: 24upx;
							color: #666;
						}
					}
	
					.b-fund {
						margin-top: 20upx;
						display: flex;
						align-items: baseline;
						justify-content: space-between;
	
						.b-amount {
							display: flex;
							align-items: baseline;
	
							.s-worth {
								margin-left: 20upx;
								font-size: 26upx;
								color: #999;
								text-decoration: line-through;
							}
	
							.s-num {
								font-size: 32upx;
								color: $pq-active-color;
							}
						}
	
						.s-count {
							font-size: 26upx;
							color: #666;
						}
					}
				}
			}

			.pet-info {
				margin-top: 20upx;
				background: #fff;
				border-radius: 12upx;
				padding: 30upx;
				border: 1px solid #EEEEEE;
				
				.info-title {
					font-size: 28upx;
					color: #333;
					font-weight: 500;
					margin-bottom: 30upx;
					display: flex;
					align-items: center;
					
					&:before {
						content: '';
						width: 4upx;
						height: 16upx;
						background: $pq-active-color;
						margin-right: 10upx;
						border-radius: 2upx;
					}
				}
				
				.pet-form {
					display: flex;
					align-items: flex-start;
					
					.form-left {
						width: 180upx;
						margin-right: 30upx;
						flex-shrink: 0;
						
						.upload {
							width: 180upx;
							height: 180upx;
							background: #F7F7F7;
							border-radius: 8upx;
							overflow: hidden;
							display: flex;
							align-items: center;
							justify-content: center;
							border: 1px dashed #DDDDDD;
							
							.preview {
								width: 100%;
								height: 100%;
								object-fit: cover;
							}
							
							.upload-btn {
								display: flex;
								flex-direction: column;
								align-items: center;
								color: #999;
								font-size: 24upx;
								
								.iconfont {
									font-size: 48upx;
									margin-bottom: 8upx;
								}
							}
						}
					}
					
					.form-right {
						flex: 1;
						
						.form-row {
							display: flex;
							align-items: center;
							margin-bottom: 20upx;
							min-height: 60upx;
							
							&:last-child {
								margin-bottom: 0;
							}
							
							.label {
								width: 100upx;
								font-size: 28upx;
								color: #333333;
								flex-shrink: 0;
							}
							
							.input {
								flex: 1;
								height: 60upx;
								background: #F7F7F7;
								border-radius: 6upx;
								padding: 0 20upx;
								font-size: 28upx;
							}
							
							.radio-group {
								flex: 1;
								display: flex;
								align-items: center;
								
								.radio {
									display: flex;
									align-items: center;
									margin-right: 40upx;
									font-size: 28upx;
									color: #333333;
									
									&:last-child {
										margin-right: 0;
									}
									
									radio {
										transform: scale(0.8);
										margin-right: 6upx;
									}
								}
							}
						}
					}
				}
			}
		}
	}

	.gift-note {
		display: flex;
		align-items: center;
		justify-content: space-between;

		.b-tit {
			width: 240upx;
			font-size: 28upx;
			color: $pq-main-color;
		}

		.b-cont {
			width: 400upx;
			font-size: 24upx;
			color: $pq-main-color;

			input {
				font-size: 28upx;
				text-align: right;
			}

			.input-placeholder,
			.placeholder {
				font-size: 28upx;
			}
		}
	}

	.box {
		margin-top: 30upx;
		padding: 30upx;
		background: #fff;
		border-radius: 20upx;

		.b-head {
			margin-bottom: 30upx;
			padding-left: 20upx;
			color: $pq-main-color;
			font-size: 28upx;
			font-weight: bold;
			position: relative;

			&:before {
				content: '';
				position: absolute;
				left: 0;
				top: 50%;
				transform: translateY(-50%);
				height: 24upx;
				width: 4upx;
				background-color: $pq-active-color;
				border-radius: 4upx;
				opacity: 0.8;
			}
		}

		.b-row {
			margin-bottom: 30upx;
			display: flex;
			justify-content: space-between;

			&:last-child {
				margin-bottom: 0;
			}

			&.f-fund {

				.b-cont {
					.s-num {
						font-size: 32upx;
						color: $pq-active-color;
					}
				}

				&.f-payment {
					border-top: 2upx solid #eee;
					padding-top: 30upx;
				}
			}

			&.f-wallet {
				align-items: center;

				.b-tit {
					width: 560upx;
					display: flex;
					align-items: center;

					.iconfont {
						font-size: 50upx;
						color: $pq-active-color;
					}

					.s-tit {
						margin-left: 10upx;
						margin-right: 10upx;
						font-size: 26upx;
						color: $pq-main-color;
					}

					.s-left {
						font-size: 24upx;

						.s-use {
							margin-left: 10upx;
							color: $pq-active-color;
						}
					}

					.s-recharge {
						margin-left: 20upx;
						color: $pq-active-color;
					}
				}

				.b-cont {
					switch {
						transform: scale(0.6)
					}
				}
			}

			&.f-pay {
				.b-tit {
					width: 320upx;
					display: flex;
					align-items: center;

					.iconfont {
						font-size: 50upx;
						color: #6CB37A;
					}

					.s-tit {
						margin-left: 10upx;
						font-size: 26upx;
						color: $pq-main-color;
					}
				}

				.b-cont {
					radio {
						transform: scale(0.8)
					}
				}
			}

			&.f-shop {
				.b-cont {
					text-align: right;
					height: 60upx;

					&.f-scan {
						padding: 0 30upx;
						color: #fff;
						font-size: 24upx;
						height: 60upx;
						border-radius: 30upx;
						background: $pq-main-color;

						.iconfont {
							margin-right: 10upx;
							font-size: 24upx;
						}
					}

					&.f-desk {}

					&.f-phone {
						input {
							font-size: 28upx;
							color: #333;
						}

						.input-placeholder,
						.placeholder {
							font-size: 28upx;
						}
					}
				}
			}

			.b-tit {
				font-size: 28upx;
				width: 160upx;
			}

			.b-cont {
				// flex: 1;
				display: flex;
				align-items: center;
			}

			.s-text {
				font-size: 28upx;
				color: $pq-main-color;
			}
		}
	}

	.navbar {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 100upx;
		background: #fff;
		border-top: 1upx solid #f6f6f6;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 20upx;
    z-index: 1;

		.b-amount {
			flex: 1;
			display: flex;
			align-items: center;

			.agreement-label {
				display: flex;
				align-items: center;
				font-size: 24upx;
				color: #666;
				
				checkbox {
					transform: scale(0.8);
					margin-right: 4upx;
				}
				
				.agreement-link {
					color: $pq-active-color;
				}
			}
		}

		.b-action {
			.s-exchange {
				background: $pq-active-color;
				height: 100upx;
				padding: 0 60upx;
				line-height: 100upx;
				font-size: 30upx;
				color: #fff;
				letter-spacing: 4upx;
			}
		}
	}

	.shipping-form {
		.form-section {
			margin-bottom: 40upx;
			background: #fff;
			border-radius: 16upx;
			padding: 20upx 30upx;

			&:last-child {
				margin-bottom: 0;
			}

			.section-title {
				font-size: 30upx;
				color: #333;
				font-weight: 600;
				margin-bottom: 30upx;
				padding-left: 20upx;
				position: relative;
				
				&:before {
					content: '';
					position: absolute;
					left: 0;
					top: 50%;
					transform: translateY(-50%);
					width: 6upx;
					height: 28upx;
					background: $pq-active-color;
					border-radius: 3upx;
				}
			}

			.form-item {
				display: flex;
				align-items: center;
				margin-bottom: 30upx;
				position: relative;

				&:last-child {
					margin-bottom: 0;
				}

				.label {
					width: 120upx;
					font-size: 28upx;
					color: #666;
					text-align: right;
					padding-right: 20upx;
				}

				.input-wrapper {
					flex: 1;
					display: flex;
					align-items: center;
					gap: 20upx;
					
					.input {
            width: 260upx;
						flex: 1;
						height: 80upx;
						background: #f8f8f8;
						border-radius: 8upx;
						padding: 0 20upx;
						font-size: 28upx;
						transition: all 0.3s;
						border: 2upx solid transparent;
						line-height: 80upx;
						
						&:focus {
							background: #fff;
							border-color: $pq-active-color;
							box-shadow: 0 0 10upx rgba(255, 149, 35, 0.1);
						}
					}
					
					.icon-calendar, .icon-address {
						font-size: 40upx;
						color: #666;
						padding: 10upx 20upx;
						margin-left: 10upx;
						flex-shrink: 0;
						
						&:active {
							opacity: 0.8;
						}
					}
				}

				.radio-group {
					flex: 1;
					display: flex;
					align-items: center;
					background: #f8f8f8;
					padding: 0 20upx;
					height: 80upx;
					border-radius: 8upx;

					.radio {
						margin-right: 60upx;
						font-size: 28upx;
						color: #666;
						display: flex;
						align-items: center;
						
						radio {
							margin-right: 8upx;
						}
					}
				}

				.upload {
					flex: 1;
					width: 200upx;
					height: 200upx;
					background: #f8f8f8;
					border-radius: 8upx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					transition: all 0.3s;
					border: 2upx dashed #ddd;

					&:active {
						background: #f0f0f0;
					}

					.preview {
						width: 100%;
						height: 100%;
						border-radius: 8upx;
						object-fit: cover;
					}

					.upload-btn {
						text-align: center;

						.iconfont {
							font-size: 48upx;
							color: #999;
							margin-bottom: 10upx;
						}

						text {
							font-size: 24upx;
							color: #999;
						}
					}
				}

				.picker {
					flex: 1;
					height: 80upx;
					background: #f8f8f8;
					border-radius: 8upx;
					padding: 0 20upx;
					font-size: 28upx;
					line-height: 80upx;
					color: #333;
					transition: all 0.3s;
					
					&:active {
						background: #f0f0f0;
					}
				}

				.textarea {
					flex: 1;
					height: 160upx;
					background: #f8f8f8;
					border-radius: 8upx;
					padding: 20upx;
					font-size: 28upx;
					transition: all 0.3s;
					border: 2upx solid transparent;
					
					&:focus {
						background: #fff;
						border-color: $pq-active-color;
						box-shadow: 0 0 10upx rgba(255, 149, 35, 0.1);
					}
				}
			}
		}
	}

	.date-picker {
		display: none;
	}
	
	.agreement-row {
		margin-top: 20upx;
		padding-top: 20upx;
		border-top: 1upx solid #eee;
		
		.agreement-label {
			display: flex;
			align-items: center;
			font-size: 26upx;
			color: #666;
			
			.agreement-link {
				color: $pq-active-color;
			}
		}
	}

	.age-inputs {
		display: flex;
		align-items: center;
		gap: 20upx;
		flex: 1;
		
		.age-input {
			width: 30upx;
			height: 60upx;
			background: #F7F7F7;
			border-radius: 6upx;
			padding: 0 20upx;
			font-size: 28upx;
			text-align: center;
			transition: all 0.3s;
			border: 2upx solid transparent;
			
			&:focus {
				background: #fff;
				border-color: $pq-active-color;
				box-shadow: 0 0 10upx rgba(255, 149, 35, 0.1);
			}
		}
		
		.age-unit {
			color: #666;
			font-size: 28upx;
			margin: 0 10upx;
		}
	}
</style>